<div id="popContainer" class="haiwi-modal">
    <div class="haiwi-modal-title">
        编 辑
    </div>
    <div class="haiwi-modal-body">
        <form id="hrmStfForm">
            <div class="">
                <div class="btn-group m-r-sm mail-hidden-options" style="display: inline-block;">
                    <div class="btn-group">
                        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                           aria-expanded="false" style="width: 360px;">${hrmStaff.hrmApartment.name?default("部门")} <span class="caret"></span></a>
                        <ul class="dropdown-menu dropdown-menu-right" role="menu" style="width: 365px;">
                            <input name="apartmentId" class="hidden" value="1">
                            <li><a href="">所有部门列表</a></li>
                        </ul>
                    </div>
                    <div class="btn-group">
                        <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                           aria-expanded="false" style="width: 360px;">${hrmStaff.hrmPost.name?default("职位")}<span class="caret"></span></a>
                        <ul class="dropdown-menu dropdown-menu-right" role="menu" style="width: 365px;">
                            <input name="postId" class="hidden" type="text" value="1">
                            <li><a href="">所有职位列表</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="input-group">
                <span class="input-group-addon">员工id</span>
                <input name="id" type="text" class="form-control" value="${hrmStaff.id?default(0)}" readonly="readonly">
                <span class="input-group-addon">姓名</span>
                <input name="name" type="text" class="form-control" value="${hrmStaff.name?default("")}">
                <span class="input-group-addon">生日</span>
                <input name="birthday" type="date" class="form-control" value="${hrmStaff.birthday?date?default("")}">
            </div>
            <div class="input-group">
                <span class="input-group-addon">性别</span>
                <input name="sex" type="text" class="form-control" value="${hrmStaff.sex?default("")}">
                <span class="input-group-addon">电话</span>
                <input name="phone" type="text" class="form-control" value="${hrmStaff.phone?default(00000000000)}">
                <span class="input-group-addon">证件</span>
                <input name="idcard" type="text" class="form-control" value="${hrmStaff.idcard?default("")}">
            </div>
            <div class="input-group">
                <span class="input-group-addon">入职时间</span>
                <input name="joinTime" type="date" class="form-control" value="${hrmStaff.joinTime?date?default("")}">
                <span class="input-group-addon">离职时间</span>
                <input name="leaveTime" type="date" class="form-control" value="${hrmStaff.leaveTime?date?default("")}">
            </div>
            <div class="input-group">
                <span class="input-group-addon">备注</span>
                <input name="remark" type="text" class="form-control" value="${hrmStaff.remark?default("")}">
            </div>

        </form>
    </div>
    <div class="haiwi-modal-bottom">
        <button class="btn btn-primary" id="save-btn">保存</button>
        <button class="btn-h28 btn-white" id="close-btn">取消</button>
    </div>
    <a href="javascript:void(0);" class="close-haiwi-modal">×</a>
    <script>
        $(function () {
            $('#close-btn').click(function () {
                $.closeHaiwiModal("popContainer");
            })
        });

        $(function () {
            $('#save-btn').click(function () {
                $.ajax({
                    type: "POST",
                    url: "/user/updateStaffInfo.post",
                    data: $('#hrmStfForm').serialize(),
                    success: function (data) {
                        var result = data;
                        if (result === 1) {
                            alert("保存成功！");
                            $.closeHaiwiModal("popContainer");
                            openView("/user/hrmStaffManage.html");
                        } else {
                            alert("保存失败，请重试");
                        }
                    },
                    error: function () {
                        alert('保存出现异常');
                    }
                })
            })
        })
    </script>
</div>